********************************************************************************************
**** DESCRIPTIVE STATISTICS OF HOUSEHOLD CHARACTERISTICS AT BASELINE AND FOLLOW-UP
**** This file generates output tables for group comparison at baseline.
**** Version: 10/03/2014
********************************************************************************************

********************************************************************************************
**** HOUSEHOLD CHARACTERISTICS
********************************************************************************************
			
		* Create table of means and comparison of means at baseline
	
				descriptive $household_char
			
					esttab using "Outputs/Household characteristics.tex", f replace noobs nonumb width(0.9\textwidth) ///
					cells("m_mu_b(fmt(3)) m_mu_1_b(fmt(3)) m_mu_2_b(fmt(3)) m_coef_c_b(fmt(3) star pvalue(m_d_p_c_b))" ///
					"m_sd(fmt(3) par([ ])) m_sd_1_b(fmt(3) par([ ])) m_sd_2_b(fmt(3) par([ ])) m_d_se_c_b(fmt(3) par)") label star(* 0.1 ** 0.05 *** 0.01) ///
					stats(N1 N2 N3 N4, layout("@ @ @ @") labels("Observations") fmt(0)) ///
					collabels("All" "HH" "Mother" "Diff") ///
					ti("Descriptive statistics on household characteristics at baseline, by treatment status\label{Household}") ///
					addn("\begin{minipage}[t]{0.89\textwidth}{\smaller Standard deviations in brackets, standard errors in parenthesis. \sym{***} denotes significance at 1\%, \sym{**} at 5\%, and \sym{*} at 10\%. The standard errors on the differences are estimated from running the corresponding least squares regression on treatment status allowing for the errors to be clustered at municipality level. Treatment status is equal to 1 if the transfer is made to mothers and zero otherwise.} \end{minipage}")

					
		* Joint test 
		
			probit mother $household_char if round == 2010, cluster(id_mun)
			testparm $household_char
					
********************************************************************************************
**** DECOMPOSITION OF EXPENDITURE
********************************************************************************************
		
		* Generate working in progress variables which work with the program features
		
			gen sh_expenditure = expenditure
			gen sh_expenditure_adj = expenditure_adj
			gen sh_pur_expenditure_adj = expenditure_adj_pur
			gen sh_sf_expenditure_adj = expenditure_adj_sf
			gen sh_stor_expenditure_adj = expenditure_adj_stor
			gen sh_gift_expenditure_adj = expenditure_adj_gift
			label var expenditure "Monthly value (MKD)"

		* Create table to present the decomposition of expenditure shares at BASELINE
			
				sum_exp $Items if round == 2010
			
					esttab using "Outputs/Decomposition of consumption (baseline).tex", f replace gaps noobs nonumb width(1\textwidth) ///
					cells("m_mu1(fmt(3)) m_mu2(fmt(3)) m_mu3(fmt(3)) m_mu4(fmt(3)) m_mu5(fmt(3)) m_mu6(fmt(3))" ///
					"m_sd1(fmt(3) par([ ])) m_sd2(fmt(3) par([ ])) m_sd3(fmt(3) par([ ])) m_sd4(fmt(3) par([ ])) m_sd5(fmt(3) par([ ])) m_sd6(fmt(3) par([ ]))") label star(* 0.1 ** 0.05 *** 0.01) ///
					stats(N1 N2 N3 N4 N5 N6, layout("@ @ @ @ @ @") labels("Observations") fmt(0)) ///
					mgroups("& & \multicolumn{4}{c}{\textit{Consumption from...}}",  pattern(1 0 0 0 0 0) span) ///
					collabels("Exp." "Cons." "Purch." "Self-prod." "Storage" "Gifts") ///
					ti("Expenditure, consumption and decomposition of consumption from different sources at baseline\label{ConsDecBase}") ///
					addn("\begin{minipage}[t]{0.9\textwidth}{\smaller 1 MKD = 0.0224 USD.} \end{minipage}" "\begin{minipage}[t]{0.98\textwidth}{\smaller Standard deviations in brackets. Decomposition of consumption is expressed as monetary value consumed for a certain good from a different source (e.g. from purchases) divided by total consumption from all sources.} \end{minipage}")
		
				* URBAN VS RURAL
				
					sum_exp $Items if round == 2010 & rural == 0
			
						esttab using "Outputs/Decomposition of consumption (baseline, urban).tex", f replace gaps noobs nonumb width(1\textwidth) ///
						cells("m_mu1(fmt(3)) m_mu2(fmt(3)) m_mu3(fmt(3)) m_mu4(fmt(3)) m_mu5(fmt(3)) m_mu6(fmt(3))" ///
						"m_sd1(fmt(3) par([ ])) m_sd2(fmt(3) par([ ])) m_sd3(fmt(3) par([ ])) m_sd4(fmt(3) par([ ])) m_sd5(fmt(3) par([ ])) m_sd6(fmt(3) par([ ]))") label star(* 0.1 ** 0.05 *** 0.01) ///
						stats(N1 N2 N3 N4 N5 N6, layout("@ @ @ @ @ @") labels("Observations") fmt(0)) ///
						mgroups("& & \multicolumn{4}{c}{\textit{Consumption from...}}",  pattern(1 0 0 0 0 0) span) ///
						collabels("Exp." "Cons." "Purch." "Self-prod." "Storage" "Gifts") ///
						ti("Expenditure, consumption and decomposition of consumption from different sources at baseline in urban areas\label{ConsDecBaseUrban}") ///
						addn("\begin{minipage}[t]{0.9\textwidth}{\smaller 1 MKD = 0.0224 USD.} \end{minipage}" "\begin{minipage}[t]{0.98\textwidth}{\smaller Standard deviations in brackets. Decomposition of consumption is expressed as monetary value consumed for a certain good from a different source (e.g. from purchases) divided by total consumption from all sources.} \end{minipage}")

					sum_exp $Items if round == 2010 & rural == 1
			
						esttab using "Outputs/Decomposition of consumption (baseline, rural).tex", f replace gaps noobs nonumb width(1\textwidth) ///
						cells("m_mu1(fmt(3)) m_mu2(fmt(3)) m_mu3(fmt(3)) m_mu4(fmt(3)) m_mu5(fmt(3)) m_mu6(fmt(3))" ///
						"m_sd1(fmt(3) par([ ])) m_sd2(fmt(3) par([ ])) m_sd3(fmt(3) par([ ])) m_sd4(fmt(3) par([ ])) m_sd5(fmt(3) par([ ])) m_sd6(fmt(3) par([ ]))") label star(* 0.1 ** 0.05 *** 0.01) ///
						stats(N1 N2 N3 N4 N5 N6, layout("@ @ @ @ @ @") labels("Observations") fmt(0)) ///
						mgroups("& & \multicolumn{4}{c}{\textit{Consumption from...}}",  pattern(1 0 0 0 0 0) span) ///
						collabels("Exp." "Cons." "Purch." "Self-prod." "Storage" "Gifts") ///
						ti("Expenditure, consumption and decomposition of consumption from different sources at baseline in rural areas\label{ConsDecBaseRural}") ///
						addn("\begin{minipage}[t]{0.9\textwidth}{\smaller 1 MKD = 0.0224 USD.} \end{minipage}" "\begin{minipage}[t]{0.98\textwidth}{\smaller Standard deviations in brackets. Decomposition of consumption is expressed as monetary value consumed for a certain good from a different source (e.g. from purchases) divided by total consumption from all sources.} \end{minipage}")
		
													
		* Create table to present the decomposition of expenditure shares at FOLLOW-UP
				
				sum_exp $Items if round == 2012
			
					esttab using "Outputs/Decomposition of consumption (follow-up).tex", f replace gaps noobs nonumb width(1\textwidth) ///
					cells("m_mu1(fmt(3)) m_mu2(fmt(3)) m_mu3(fmt(3)) m_mu4(fmt(3)) m_mu5(fmt(3)) m_mu6(fmt(3))" ///
					"m_sd1(fmt(3) par([ ])) m_sd2(fmt(3) par([ ])) m_sd3(fmt(3) par([ ])) m_sd4(fmt(3) par([ ])) m_sd5(fmt(3) par([ ])) m_sd6(fmt(3) par([ ]))") label star(* 0.1 ** 0.05 *** 0.01) ///
					stats(N1 N2 N3 N4 N5 N6, layout("@ @ @ @ @ @") labels("Observations") fmt(0)) ///
					mgroups("& & \multicolumn{4}{c}{\textit{Consumption from...}}",  pattern(1 0 0 0 0 0) span) ///
					collabels("Exp." "Cons." "Purch." "Self-prod." "Storage" "Gifts") ///
					ti("Expenditure, consumption and decomposition of consumption from different sources at follow-up\label{ConsDecFollow}") ///
					addn("\begin{minipage}[t]{0.9\textwidth}{\smaller 1 MKD = 0.0224 USD.} \end{minipage}" "\begin{minipage}[t]{0.98\textwidth}{\smaller Standard deviations in brackets. Decomposition of consumption is expressed as monetary value consumed for a certain good from a different source (e.g. from purchases) divided by total consumption from all sources.} \end{minipage}")
		
		* Drop working in progress variables which work with the program features	
		
			drop sh_expenditure sh_expenditure_adj sh_pur_expenditure_adj sh_sf_expenditure_adj sh_stor_expenditure_adj sh_gift_expenditure_adj
			label var expenditure "Monthly expenditure (MKD)"
					
